package com.ks.user.controller;


import com.ks.core.base._ControllerBase;
import com.ks.core.core.Result;
import com.ks.core.dto.SearchCriteriaBase;
import com.ks.user.controller.dto.ApBaseRequest;
import com.ks.user.entity.DashboadBase;
import com.ks.user.entity.DashboadTenant;
import com.ks.user.service.IDashboadBaseService;
import com.ks.user.service.IDashboadTenantService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 看板-系统中的看板清单 前端控制器
 * </p>
 *
 * @author kingdee123
 * @since 2020-12-24
 */
@RestController
@RequestMapping("/dashboadBase")
@Api(value = "租户看板模块", description = "租户看板模块")
public class DashboadBaseController extends _ControllerBase {

    @Autowired
    private IDashboadBaseService dashboadBaseService;

    @Autowired
    private IDashboadTenantService dashboadTenantService;


    @PostMapping("/selectBaseSys")
    @ApiOperation(value = "应用看板配置数据查询接口",notes = "应用看板配置数据查询接口")
    public Object selectBaseSys (@RequestBody ApBaseRequest apBaseRequest){
        Map<String,Object> resultMap =dashboadBaseService.selectBaseSys(getContext(),apBaseRequest);
        return Result.success(resultMap);
    }


    @PostMapping("/addBase")
    @ApiOperation(value = "应用看板配置数据添加接口",notes = "应用看板配置数据添加接口")
    public Object addDashboadBase (@RequestBody DashboadBase dashboadBase){
        int resultMap =dashboadBaseService.addDashboadBase(getContext(),dashboadBase);
        return Result.success(resultMap);
    }


    @PostMapping("/updateBase")
    @ApiOperation(value = "应用看板配置数据修改接口",notes = "应用看板配置数据修改接口")
    public Object updateDashboadBase (@RequestBody DashboadBase dashboadBase){
        int resultMap =dashboadBaseService.updateDashboadBase(getContext(),dashboadBase);
        return Result.success(resultMap);
    }

    @PostMapping("/deleteBase")
    @ApiOperation(value = "应用看板配置数据删除接口",notes = "应用看板配置数据删除接口")
    public Object deleteDashboadBase (@RequestBody ApBaseRequest apBaseRequest){
        int resultMap =dashboadBaseService.deleteDashboadBase(getContext(),apBaseRequest);
        return Result.success(resultMap);
    }


    @PostMapping("/selectTenant")
    @ApiOperation(value = "租户看板配置数据查询接口",notes = "租户看板配置数据查询接口")
    public Object selectDashboadTenant (@RequestBody ApBaseRequest apBaseRequest){
        Map<String,Object> resultMap =dashboadTenantService.selectDashboadTenant(getContext(),apBaseRequest);
        return Result.success(resultMap);
    }

    @PostMapping("/updateTenant")
    @ApiOperation(value = "租户看板配置数据修改接口",notes = "租户看板配置数据修改接口")
    public Object updateDashboadTenant (@RequestBody DashboadTenant dashboadTenant){
        int resultMap =dashboadTenantService.updateDashboadTenant(getContext(),dashboadTenant);
        return Result.success(resultMap);
    }
}

